package 课后作业;

import java.util.Scanner;

public class Calcolate {




    public static void main(String[] args) {
            double result =0.0;
        Calculator calculator=new Calculator();
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入第一个数：");
        calculator.num1=sc.nextInt();
        System.out.println("请输入运算符(+,-,*,/):");
        char cr =sc.next().charAt(0);
        System.out.print("请输入第二个数：");
        calculator.num2 =sc.nextInt();
        switch (cr){
            case '+':
                System.out.println(calculator.num1+calculator.num2);
                break;
            case '-':
                System.out.println(calculator.num1-calculator.num2);
                break;
            case '*':
                System.out.println(calculator.num1*calculator.num2);
                break;
            case '/':
                if (calculator.num2==0)
                {
                    System.out.println("除数不能为0");}
                    else {
                System.out.println(calculator.num1/calculator.num2);}
                break;
        }
    }
}
